package design.patterns.exercise;

/**
 * @Desc:   懒汉，线程不安全，但轻量一点
 * @author: cww
 * @DateTime: 2020-04-17 18:45
 */

public class SingletonLazyNotSafe {
    private static SingletonLazyNotSafe singletonLazyNotSafe;

    /**
     * 私有化构造函数，不允许直接创建对象
     * @param
     */
    private SingletonLazyNotSafe() {

    }

    /**
     * 这里存在线程安全问题
     * @return
     */
    public static SingletonLazyNotSafe getInstance(){
        if (singletonLazyNotSafe == null){
            singletonLazyNotSafe = new SingletonLazyNotSafe();
        }
        return singletonLazyNotSafe;
    }
}
